<<<<<<< HEAD

=======
>>>>>>> 2f2681559102dd200f119afb607054cf37b8104a
import jsonp from 'jsonp'

export default function(url, data, option){
	url += (url.indexOf('?') < 0 ? '?' : '&') + param(data)

	return new Promise((resolve, reject) => {
    	jsonp(url, option, (err, data) => {
      		if (!err) {
        		  resolve(data)
	      	} else {
	        	  reject(err)
	      	}
    	})
  	})
}

function param(data) {
  	let url = ''
  	for (var k in data) {
    	 let value = data[k] !== undefined ? data[k] : ''
    	 url += '&' + k + '=' + encodeURIComponent(value)
  	}
  	return url ? url.substring(1) : ''
}
<<<<<<< HEAD
 
=======

>>>>>>> 2f2681559102dd200f119afb607054cf37b8104a
